﻿@using winproject.Controllers;
<div class="row">
    <div class="col-md-5 ">
        Logo
    </div>
    <div class="col-md-7 nopadding-prefer-right text-right">
        <table style="width:100%">
            <tr>
                <td>
                    <div class="input-group">
                        <input type="text" class="form-control">
                        <span class="input-group-btn">
                            <button class="btn btn-default" type="button">Go!</button>
                        </span>
                    </div>
                </td>
                <td>
                    &nbsp;&nbsp;
                </td>
                <td>
                    <button class="btn btn-primary" type="button">
                      Messages <span class="badge">4</span>
                    </button>
                </td>
            </tr>
        </table>
    </div>
</div>
<div>
    &nbsp;
</div>
<nav class="navbar navbar-default" role="navigation">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">Brand</a>
    </div>
    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
        <li><a href="#">Link</a></li>
        <li class="dropdown menu-large">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Categories <b class="caret"></b></a>                
                <ul class="dropdown-menu megamenu row">
                    @{
        
                        HelperController oHelper = new HelperController();
                        ReturnResult oCatResult = null;
                        CategoryDetails oCatSearch = new CategoryDetails();
                        List<CategoryDetails> lsCat = oHelper.GetCategoryDetails(out oCatResult, oCatSearch);
                        int rowMod = 0;
                        int itemcount = 0;
                        if (oCatResult.errCode == (int)cEnums.eErrorCodes.Success)
                        {
                            ReturnResult oSubCatResult = null;
                            SubCategoryDetails oSubCatSearch = new SubCategoryDetails();
                            if(lsCat!=null && lsCat.Count>0){
                           
                                foreach(var lCat in lsCat){
                                    <li class="col-sm-3">
                                    <ul>
                                    @{
                                        itemcount++;
                                        oSubCatSearch.nParentId = lCat.nItemId;
                                        List<SubCategoryDetails> lsSubCat = oHelper.GetSubCategoryDetails(out oSubCatResult, oSubCatSearch);
                                        if(lsSubCat!=null && lsSubCat.Count>0){
                                            <li class="dropdown-header"><a href="Category/@lCat.sItemSlug">@lCat.sItemName</a></li>
                                            foreach(var lsubCat in lsSubCat){  
                                                <li><a href="Subcategory/@lsubCat.sItemSlug">@lsubCat.sItemName</a></li>
                                            }
                                            <li class="divider"></li>
                                        }
                                        if(itemcount%4==0){
                                            Response.Write("</ul></li><li class=\"col-sm-3\"><ul>");
                                        }
                                    }
                                    </ul>
                                    </li>
                                }
                                
                            }
                        }
                    }
                    
                </ul> 
            </li>
        </ul>
    </div>
    </div>
</nav>